<template>
  <view class="my-search-container" :style="{'background-color':bgcolor}" @click="searchBoxHandler">
    <view class="my-search-box" :style="{'border-radius':radius+'px'}">
      <uni-icons type="search" size="15px"></uni-icons>
      <text>搜索</text>
    </view>
  </view>
</template>
<script>
  export default {
    props: {
      bgcolor: {
        type: String,
        default: '#007aff'
      },
      // 圆角尺寸
      radius: {
        type: Number,
          // 单位是 px
        default: 18
        }
    },
    methods:{
      searchBoxHandler(){
        //触发my-search组件绑定的事件 
        this.$emit('click')
      }
    }
  }
</script>
<style lang="scss">
  .my-search-container {
    background-color: #007aff;
    height: 50px;
    display: flex;
    padding: 0 10px;
    align-items: center;

    .my-search-box {
      width: 100%;
      background-color: white;
      display: flex;
      align-items: center;
      border-radius: 10px;
      height: 40px;
      justify-content: center;

      text {
        margin-left: 5px;
        font-size: 15px;
      }
    }
  }
</style>